package com.ai.bitcoin.common.resp;

import com.ai.bitcoin.enums.ResponseEnum;
import lombok.Data;

import java.io.Serializable;

/**
 * Created by gulj on 2018/6/11.
 */
@Data
public class ResponseEntity<T> implements Serializable {

    private static final long serialVersionUID = 1L;
    private int code;

    private String msg;

    private T data;

    public ResponseEntity() {
    }

    public ResponseEntity(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseEntity(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResponseEntity(ResponseEnum responseEnum) {
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMsg();
    }

    public ResponseEntity(ResponseEnum responseEnum, T data) {
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMsg();
        this.data = data;
    }
}
